using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VWASTGA
    {
        public void SetUpNewRow(ref DataRow dwReturn)
        {

            switch (app.company)
            {
                case "YGR":
                case "TST":
                case "UBT":
                default:
                    #region=========
                    dwReturn["WAGMANDANT"] = "00";
                    dwReturn["WAGKUNDNR"] = "00000000";
                    dwReturn["WAGWERK"] = "   ";
                    dwReturn["WAGABT"] = "   ";
                    dwReturn["WAGART"] = "                    ";
                    dwReturn["WAGVAR"] = "  ";
                    dwReturn["WAGWCOL"] = "          ";
                    dwReturn["WAGPSA"] = "1";
                    dwReturn["WAGPOS"] = "00";
                    dwReturn["WAGFOLGEPOS"] = "1";
                    dwReturn["WAGGART"] = "                    ";
                    dwReturn["WAGGVAR"] = "   ";
                    dwReturn["WAGGFARBE"] = "          ";
                    dwReturn["WAGFDZ"] = "1";
                    dwReturn["WAGABFKZ"] = " ";
                    dwReturn["WAGABF"] = "0";
                    dwReturn["WAGABFLG"] = "0";
                    dwReturn["WAGKGNET"] = "0";
                    dwReturn["WAGKGBRUT"] = "0";
                    dwReturn["WAGDISPOKZ"] = "B";
                    dwReturn["WAGBEM"] = "T1        ";
                    dwReturn["WAGEAFAKTOR"] = "0";
                    dwReturn["WAGGRLFDM"] = "0";
                    dwReturn["WAGKZQM"] = " ";
                    dwReturn["WAGPROZWG"] = "0";
                    dwReturn["WAGABFALL"] = "0";
                    dwReturn["WAGAUFM"] = "01";
                    dwReturn["WAGANT"] = "0";
                    dwReturn["WAGEINL"] = "49";
                    dwReturn["WAGSPANNV"] = "0";
                    dwReturn["WAGSPANNB"] = "0";
                    dwReturn["WAGSPANNF"] = "00";
                    dwReturn["WAGVARKZ"] = " ";
                    dwReturn["WAGNA1"] = "0";
                    dwReturn["WAGNA2"] = "0";
                    dwReturn["WAGNA3"] = "0";
                    dwReturn["WAGNA4"] = "0";
                    dwReturn["WAGNA5"] = "0";
                    dwReturn["WAGNP"] = "0";
                    dwReturn["WAGWEAVIN"] = "0";
                    dwReturn["WAGWEEMBR"] = "0";
                    dwReturn["WAGFLOATING"] = "0";
                    dwReturn["WAGFL"] = "  ";
                    dwReturn["WAGFLNA1"] = "0";
                    dwReturn["WAGFLNA2"] = "0";
                    dwReturn["WAGFLNA3"] = "0";
                    dwReturn["WAGFLNA4"] = "0";
                    dwReturn["WAGFLNA5"] = "0";
                    dwReturn["WAGFLNP"] = "0";
                    dwReturn["WAGFILLER"] = "                                              ";

                    #endregion
                    break;
                case "JLT":

                    break;
            }
        }
        public void MapWASTGA(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }
        public void SaveWASTGA(DataRow dwData, DataRow dwDispo)
        {
            DataSet setResult = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            setResult = QueryWASTGA(dwData);
            if (setResult.Tables.Count > 0)
            {
                tbLocal = setResult.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                    dwLocal = tbLocal.Rows[0];
                }
                else
                {
                    dwLocal = tbLocal.NewRow();
                }
            }

            MapWASTGA(ref dwLocal, dwData);

            InsertWASTGA(dwLocal);
            UpdateWASTGA(dwLocal);
        }
        public void InsertWASTGA(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            or1 = OracleDB.CreateCommand();
            switch (app.company)
            {
                case "JLT":
                    or1.CommandText = "INSERT INTO WASTGA ( WAGMANDANT,WAGKUNDNR,WAGWERK,WAGABT,WAGART,WAGVAR,WAGWCOL,WAGPSA,WAGPOS,WAGFOLGEPOS,WAGGART,WAGGVAR,WAGGFARBE,WAGFDZ,WAGABFKZ,WAGABF,WAGABFLG,WAGKGNET,WAGKGBRUT,WAGDISPOKZ,WAGBEM,WAGEAFAKTOR,WAGGRLFDM,WAGKZQM,WAGPROZWG,WAGABFALL,WAGAUFM,WAGANT,WAGEINL,WAGSPANNV,WAGSPANNB,WAGSPANNF,WAGVARKZ,WAGNA1,WAGNA2,WAGNA3,WAGNA4,WAGNA5,WAGNP,WAGWEAVIN,WAGWEEMBR,WAGFLOATING,WAGFL,WAGFLNA1,WAGFLNA2,WAGFLNA3,WAGFLNA4,WAGFLNA5,WAGFLNP,WAGFILLER)"
                    + " VALUES (:WAGMANDANT:,:WAGKUNDNR:,:WAGWERK:,:WAGABT:,:WAGART:,:WAGVAR:,:WAGWCOL:,:WAGPSA:,:WAGPOS:,:WAGFOLGEPOS:,:WAGGART:,:WAGGVAR:,:WAGGFARBE:,:WAGFDZ:,:WAGABFKZ:,:WAGABF:,:WAGABFLG:,:WAGKGNET:,:WAGKGBRUT:,:WAGDISPOKZ:,:WAGBEM:,:WAGEAFAKTOR:,:WAGGRLFDM:,:WAGKZQM:,:WAGPROZWG:,:WAGABFALL:,:WAGAUFM:,:WAGANT:,:WAGEINL:,:WAGSPANNV:,:WAGSPANNB:,:WAGSPANNF:,:WAGVARKZ:,:WAGNA1:,:WAGNA2:,:WAGNA3:,:WAGNA4:,:WAGNA5:,:WAGNP:,:WAGWEAVIN:,:WAGWEEMBR:,:WAGFLOATING:,:WAGFL:,:WAGFLNA1:,:WAGFLNA2:,:WAGFLNA3:,:WAGFLNA4:,:WAGFLNA5:,:WAGFLNP:,:WAGFILLER:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case "YGR":
                case "TST":
                case "UBT":
                default:
                    or1.CommandText = "INSERT INTO WASTGA ( WAGMANDANT,WAGKUNDNR,WAGWERK,WAGABT,WAGART,WAGVAR,WAGWCOL,WAGPSA,WAGPOS,WAGFOLGEPOS,WAGGART,WAGGVAR,WAGGFARBE,WAGFDZ,WAGABFKZ,WAGABF,WAGABFLG,WAGKGNET,WAGKGBRUT,WAGDISPOKZ,WAGBEM,WAGEAFAKTOR,WAGGRLFDM,WAGKZQM,WAGPROZWG,WAGABFALL,WAGAUFM,WAGANT,WAGEINL,WAGSPANNV,WAGSPANNB,WAGSPANNF,WAGVARKZ,WAGNA1,WAGNA2,WAGNA3,WAGNA4,WAGNA5,WAGNP,WAGWEAVIN,WAGWEEMBR,WAGFLOATING,WAGFL,WAGFLNA1,WAGFLNA2,WAGFLNA3,WAGFLNA4,WAGFLNA5,WAGFLNP,WAGFILLER)"
                        + " VALUES (:WAGMANDANT:,:WAGKUNDNR:,:WAGWERK:,:WAGABT:,:WAGART:,:WAGVAR:,:WAGWCOL:,:WAGPSA:,:WAGPOS:,:WAGFOLGEPOS:,:WAGGART:,:WAGGVAR:,:WAGGFARBE:,:WAGFDZ:,:WAGABFKZ:,:WAGABF:,:WAGABFLG:,:WAGKGNET:,:WAGKGBRUT:,:WAGDISPOKZ:,:WAGBEM:,:WAGEAFAKTOR:,:WAGGRLFDM:,:WAGKZQM:,:WAGPROZWG:,:WAGABFALL:,:WAGAUFM:,:WAGANT:,:WAGEINL:,:WAGSPANNV:,:WAGSPANNB:,:WAGSPANNF:,:WAGVARKZ:,:WAGNA1:,:WAGNA2:,:WAGNA3:,:WAGNA4:,:WAGNA5:,:WAGNP:,:WAGWEAVIN:,:WAGWEEMBR:,:WAGFLOATING:,:WAGFL:,:WAGFLNA1:,:WAGFLNA2:,:WAGFLNA3:,:WAGFLNA4:,:WAGFLNA5:,:WAGFLNP:,:WAGFILLER:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }
            Connect2Proxy(or1);
        }
        public override string BATCHINSERT(DataRow dwData)
        { 
            string value = "";
            switch (app.company)
            {
                default:
                case "SXN":
                case "YGR":
                case "TST":
                    value = "INTO WASTGA  "
                        + " VALUES (:WAGMANDANT:,:WAGKUNDNR:,:WAGWERK:,:WAGABT:,:WAGART:,:WAGVAR:,:WAGWCOL:,:WAGPSA:,:WAGPOS:,:WAGFOLGEPOS:,:WAGGART:,:WAGGVAR:,:WAGGFARBE:,:WAGFDZ:,:WAGABFKZ:,:WAGABF:,:WAGABFLG:,:WAGKGNET:,:WAGKGBRUT:,:WAGDISPOKZ:,:WAGBEM:,:WAGEAFAKTOR:,:WAGGRLFDM:,:WAGKZQM:,:WAGPROZWG:,:WAGABFALL:,:WAGAUFM:,:WAGANT:,:WAGEINL:,:WAGSPANNV:,:WAGSPANNB:,:WAGSPANNF:,:WAGVARKZ:,:WAGNA1:,:WAGNA2:,:WAGNA3:,:WAGNA4:,:WAGNA5:,:WAGNP:,:WAGWEAVIN:,:WAGWEEMBR:,:WAGFLOATING:,:WAGFL:,:WAGFLNA1:,:WAGFLNA2:,:WAGFLNA3:,:WAGFLNA4:,:WAGFLNA5:,:WAGFLNP:,:WAGFILLER:)";
                    value = INTEXDBC.InjectData(value, dwData);
                    break;
            }
            return value;
        }
        public void DeleteWASTGA(string client, string art, string var, string color)
        { 
            dwData = TBMain.NewRow();
            dwData["WAGMANDANT"] = client;
            dwData["WAGART"] = art;
            dwData["WAGVAR"] = var;
            dwData["WAGWCOL"] = color;
            DWG01(dwData);
        }
        public void DWG01(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE WASTGA WHERE  "
            + "  WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART: AND WAGVAR=:WAGVAR: AND WAGWCOL=:WAGWCOL:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData); ;
            Connect2Proxy(or1);
        }
        public void DWG02(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE WASTGA WHERE  "
            + "  WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART: AND WAGVAR=:WAGVAR: AND WAGWCOL=:WAGWCOL: AND WAGPSA=:WAGPSA: AND WAGPOS=:WAGPOS: AND WAGFOLGEPOS=:WAGFOLGEPOS:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData); ;
            Connect2Proxy(or1);
        }
        public DataSet QueryWASTGA(DataRow dwData, int option = 1)
        {

            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    SResult = QWGA00(dwData);
                    break;
                case 1:
                    SResult = QWGA01(dwData);
                    break;
                case 2:
                    SResult = QWGA02(dwData);
                    break;
                case 4:
                    SResult = QWGA04(dwData);
                    break;
                default:
                    SResult = QWGA99(dwData);
                    break;
            }

            return SResult;
        }
        public DataSet QWGA00(DataRow dwData)
        {


            or1 = OracleDB.CreateCommand();

            or1.CommandText = "SELECT * FROM WASTGA WHERE  ROWNUM<2 ";

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWGA01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            //or1.CommandText = "SELECT * FROM WASTGA WHERE  "
            //    + "  WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART: AND WAGVAR=:WAGVAR: AND WAGWCOL=:WAGWCOL: AND WAGPOS=:WAGPOS: AND WAGFOLGEPOS=:WAGFOLGEPOS:"
            //    + " ORDER BY WAGART,WAGVAR,WAGWCOL,WAGPOS";
            or1.CommandText = "SELECT * FROM WASTGA WHERE  "
               + "  WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART: AND WAGVAR=:WAGVAR: AND WAGWCOL=:WAGWCOL: AND WAGPOS=:WAGPOS: AND WAGFOLGEPOS=:WAGFOLGEPOS:"
               + " ORDER BY WAGFOLGEPOS";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData); ;

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWGA02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            //or1.CommandText = "SELECT M.*,NVL(GSFERTKZ,' ') AS GSFERTKZ FROM WASTGA M   "
            //         + " JOIN GSCOLOR ON GSCART=WAGGART AND GSCVAR=WAGGVAR AND  GSCFARBE= WAGGFARBE  LEFT JOIN GSDAT ON GSCART=GSART AND GSCVAR=GSVAR"
            //         + "  WHERE WAGMANDANT=:WAGMANDANT: AND WAGPSA='1' AND WAGART=:WAGART: AND WAGVAR=:WAGVAR: AND WAGWCOL=:WAGWCOL:  " 
            //         + " ORDER BY WAGART,WAGVAR,WAGWCOL,WAGPOS";
            or1.CommandText = "SELECT M.*,NVL(GSFERTKZ,' ') AS GSFERTKZ FROM WASTGA M   "
                    + " LEFT JOIN GSCOLOR ON GSCART=WAGGART AND GSCVAR=WAGGVAR AND  GSCFARBE= WAGGFARBE  LEFT JOIN GSDAT ON GSCART=GSART AND GSCVAR=GSVAR"
                    + "  WHERE WAGMANDANT=:WAGMANDANT: AND WAGPSA='1' AND WAGART=:WAGART: AND WAGVAR=:WAGVAR: AND WAGWCOL=:WAGWCOL:  "
                    + " ORDER BY WAGFOLGEPOS";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWGA04(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            //or1.CommandText = "SELECT DISTINCT   WF.*,GSCBEZ FROM WDECK WD RIGHT JOIN WASTGA WF ON"
            //    + "  WAGMANDANT=WDMANDANT AND WAGART=WDART AND WAGVAR=WDVAR"
            //    + " JOIN GSCOLOR ON GSCART=WAGGART AND GSCVAR=WAGGVAR AND  GSCFARBE= WAGGFARBE"
            //    + " LEFT JOIN GSDAT ON GSCART=GSART AND GSCVAR=GSVAR"
            //    + " WHERE WDMANDANT=:WDMANDANT: AND WDSA='K' AND WDTYP='B' AND WDWAKZ='F' AND WDAUFKRS=:WDAUFKRS:  AND WDAUFLFD=:WDAUFLFD:"
            //    + " ORDER BY WAGART,WAGVAR,WAGWCOL,WAGPOS";
            or1.CommandText = "SELECT DISTINCT   WF.*,GSCBEZ FROM WDECK WD RIGHT JOIN WASTGA WF ON"
                + "  WAGMANDANT=WDMANDANT AND WAGART=WDART AND WAGVAR=WDVAR"
                + " JOIN GSCOLOR ON GSCART=WAGGART AND GSCVAR=WAGGVAR AND  GSCFARBE= WAGGFARBE"
                + " LEFT JOIN GSDAT ON GSCART=GSART AND GSCVAR=GSVAR"
                + " WHERE WDMANDANT=:WDMANDANT: AND WDSA='K' AND WDTYP='B' AND WDWAKZ='F' AND WDAUFKRS=:WDAUFKRS:  AND WDAUFLFD=:WDAUFLFD:"
                + " ORDER BY WAGFOLGEPOS";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWGA99(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            //or1.CommandText = "SELECT * FROM WASTGA WHERE  "
            //    + "  WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART: AND WAGVAR=:WAGVAR:"
            //    + " ORDER BY WAGART,WAGVAR,WAGWCOL,WAGPOS";
            or1.CommandText = "SELECT * FROM WASTGA WHERE  "
                + "  WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART: AND WAGVAR=:WAGVAR:"
                + " ORDER BY WAGFOLGEPOS";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }

        public void UpdateWASTGA(DataRow dwData, int option = 1)
        {

            if (option == 0)
            {
                switch (app.company)
                {
                    case "JLT":
                        UWGA01(dwData);
                        break;
                    case "YGR":
                    case "TST":
                    case "UBT":
                    default:
                        UWGA02(dwData);
                        break;
                }
            }

        }
        public void UWGA02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE WASTGA SET WAGMANDANT=:WAGMANDANT:,WAGKUNDNR=:WAGKUNDNR:,WAGWERK=:WAGWERK:,WAGABT=:WAGABT:,WAGART=:WAGART:,WAGVAR=:WAGVAR:,WAGWCOL=:WAGWCOL:,WAGPSA=:WAGPSA:,WAGPOS=:WAGPOS:,WAGFOLGEPOS=:WAGFOLGEPOS:,WAGGART=:WAGGART:,WAGGVAR=:WAGGVAR:,WAGGFARBE=:WAGGFARBE:,WAGFDZ=:WAGFDZ:,WAGABFKZ=:WAGABFKZ:,WAGABF=:WAGABF:,WAGABFLG=:WAGABFLG:,WAGKGNET=:WAGKGNET:,WAGKGBRUT=:WAGKGBRUT:,WAGDISPOKZ=:WAGDISPOKZ:,WAGBEM=:WAGBEM:,WAGEAFAKTOR=:WAGEAFAKTOR:,WAGGRLFDM=:WAGGRLFDM:,WAGKZQM=:WAGKZQM:,WAGPROZWG=:WAGPROZWG:,WAGABFALL=:WAGABFALL:,WAGAUFM=:WAGAUFM:,WAGANT=:WAGANT:,WAGEINL=:WAGEINL:,WAGSPANNV=:WAGSPANNV:,WAGSPANNB=:WAGSPANNB:,WAGSPANNF=:WAGSPANNF:,WAGVARKZ=:WAGVARKZ:,WAGNA1=:WAGNA1:,WAGNA2=:WAGNA2:,WAGNA3=:WAGNA3:,WAGNA4=:WAGNA4:,WAGNA5=:WAGNA5:,WAGNP=:WAGNP:,WAGWEAVIN=:WAGWEAVIN:,WAGWEEMBR=:WAGWEEMBR:,WAGFLOATING=:WAGFLOATING:,WAGFL=:WAGFL:,WAGFLNA1=:WAGFLNA1:,WAGFLNA2=:WAGFLNA2:,WAGFLNA3=:WAGFLNA3:,WAGFLNA4=:WAGFLNA4:,WAGFLNA5=:WAGFLNA5:,WAGFLNP=:WAGFLNP:,WAGFILLER=:WAGFILLER:"
                   + " WHERE    WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART:  AND WAGVAR=:WAGVAR:  AND WAGWCOL=:WAGWCOL:  AND WAGPSA=:WAGPSA: AND WAGPOS=:WAGPOS: AND WAGFOLGEPOS=:WAGFOLGEPOS:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
        public void UWGA01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE WASTGA SET WAGMANDANT=:WAGMANDANT:,WAGKUNDNR=:WAGKUNDNR:,WAGWERK=:WAGWERK:,WAGABT=:WAGABT:,WAGART=:WAGART:,WAGVAR=:WAGVAR:,WAGWCOL=:WAGWCOL:,WAGPSA=:WAGPSA:,WAGPOS=:WAGPOS:,WAGFOLGEPOS=:WAGFOLGEPOS:,WAGGART=:WAGGART:,WAGGVAR=:WAGGVAR:,WAGGFARBE=:WAGGFARBE:,WAGFDZ=:WAGFDZ:,WAGABFKZ=:WAGABFKZ:,WAGABF=:WAGABF:,WAGABFLG=:WAGABFLG:,WAGKGNET=:WAGKGNET:,WAGKGBRUT=:WAGKGBRUT:,WAGDISPOKZ=:WAGDISPOKZ:,WAGBEM=:WAGBEM:,WAGEAFAKTOR=:WAGEAFAKTOR:,WAGGRLFDM=:WAGGRLFDM:,WAGKZQM=:WAGKZQM:,WAGPROZWG=:WAGPROZWG:,WAGABFALL=:WAGABFALL:,WAGAUFM=:WAGAUFM:,WAGANT=:WAGANT:,WAGEINL=:WAGEINL:,WAGSPANNV=:WAGSPANNV:,WAGSPANNB=:WAGSPANNB:,WAGSPANNF=:WAGSPANNF:,WAGVARKZ=:WAGVARKZ:,WAGNA1=:WAGNA1:,WAGNA2=:WAGNA2:,WAGNA3=:WAGNA3:,WAGNA4=:WAGNA4:,WAGNA5=:WAGNA5:,WAGNP=:WAGNP:,WAGWEAVIN=:WAGWEAVIN:,WAGWEEMBR=:WAGWEEMBR:,WAGFLOATING=:WAGFLOATING:,WAGFL=:WAGFL:,WAGFLNA1=:WAGFLNA1:,WAGFLNA2=:WAGFLNA2:,WAGFLNA3=:WAGFLNA3:,WAGFLNA4=:WAGFLNA4:,WAGFLNA5=:WAGFLNA5:,WAGFLNP=:WAGFLNP:,WAGFILLER=:WAGFILLER:"
                   + " WHERE    WAGMANDANT=:WAGMANDANT: AND WAGART=:WAGART:  AND WAGVAR=:WAGVAR:  AND WAGWCOL=:WAGWCOL:  AND WAGPSA=:WAGPSA: AND WAGPOS=:WAGPOS: AND WAGFOLGEPOS=:WAGFOLGEPOS:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
    }

}
